<?
session_start();
header( "Content-Type: text/html; Charset=utf-8" );
header( "pragma: no-cache" );
header( "Expires: Wed, 31 May 2000 14:59:58 GMT" );
header( "Cache-control: no-cache" );


foreach( $_GET as $Key => $Value ) {
	$_GET[$Key] = str_replace("\\\\", "\\", $Value );
	$_GET[$Key] = str_replace("\\'", "'", $_GET[$Key] );
	$_GET[$Key] = str_replace("\\\"", "\"", $_GET[$Key] );
}

//*****************************************************************************
//DB
//*****************************************************************************
$Server = 'PC-025';
$DbName = 'circle_manager';
$User = 'root';
$Password = 'password';

//*****************************************************************************
//接続処理
//*****************************************************************************
$Connect = @mysql_connect( $Server, $User, $Password );
if ( !$Connect ) {
	print "接続エラーです";
	exit();
}

//*****************************************************************************
//DB選択
//*****************************************************************************
mysql_select_db( $DbName, $Connect );
mysql_query("set names 'utf8'", $Connect);

//*****************************************************************************
//クエリ
//*****************************************************************************
$result = mysql_query("insert into user(twitter_username,username,email,twitter_icon) values('{$_SESSION['twitter_username']}','{$_POST['username']}','{$_POST['email']}','{$_SESSION['twitter_icon']}')", $Connect);
if ( !$result ) {
	print "\n";
	print "<span style='color:#f00'>" . mysql_error() . "</span>";
}

//*****************************************************************************
//列数
//*****************************************************************************
$nField = @mysql_num_fields( $result );
if ( $nField ) {
	$nCount = 0;
	while ($row = mysql_fetch_row($result)) {
		for( $i = 0; $i < $nField; $i++ ) {
		}
		$nCount++;
	}
}


//*****************************************************************************
//接続解除
//*****************************************************************************
mysql_close($Connect);

//*****************************************************************************
//ログイン後画面にジャンプ
//*****************************************************************************
header("location: http://localhost/sinkyu/twitter_0703/goal.php");
exit;
?>
